<template>
	<view class="addpeo">
		<!-- 边框 -->
		<view class="address_border"></view>
		<view class="nodata1" v-if="listlUser.length == 0">暂无体检人</view>
		<!-- 边框 -->
		<view class="address_border"></view>
		<!-- 数据 -->
		<view class="address_box">
			<view class="address_bos info_border" v-for="(item,index) in listlUser" :key="index" @click="Onpath(item.id)"
				v-show="listlUser.length > 0">
				<view class="address_info">
					<view class="address_info_box">
						<view class="address_name font-323232 font14">{{item.name}}</view>
					</view>
					<view class="address_address font-323232 font14">手机号码:{{item.mobile}}</view>
				</view>
				<view class="address_edit flex-column-between">
					<image src="../../../static/my/edit.png"></image>
					<view  class="font12 font-ff4646" @click.stop="Oncolse(item)">删除</view>
				</view>
			</view>
		</view>
		<!-- 添加地址 -->
		<view class="custom_class" @click="Onadd">添 加 就 诊 人</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listlUser: [], //体检人列表
			}
		},
		onLoad: function(options) {
			//获取体检人列表
			this.OnlistlUser()
		},
		methods: {
			//获取体检人列表
			OnlistlUser() {
				this.$Http({
					url: 'listPhysicalUser',
					data: {}
				}).then(res => {
					if (res.code == 1) {
						this.listlUser = res.data
					}
				})
			},
			//删除体检人
			Oncolse(e) {
				var that = this
				uni.showModal({
					title: '删除提示',
					content: '您确定要删除体检人?',
					confirmText: '取消', //确定文字
					confirmColor: '#6bcbb6',
					cancelText: '确定删除', //取消文字
					cancelColor: '#9c9c9c',
					success(res) {
						if (res.confirm) {} else if (res.cancel) {
							that.$Http({
								url: 'delPhysicalUser',
								show: true,
								data: {
									physical_user_id: e.id,
								}
							}).then(res => {
								if (res.code == 1) {
									that.OnlistlUser()
								}
							})
						}
					}
				})
			},
			Onpath(e){
				uni.navigateTo({
					url: '/pagesA/check/addpeo/addpeo?Pid='+e,
				})
			},
			Onadd(){
				uni.navigateTo({
					url: '/pagesA/check/addpeo/addpeo',
				})
			}
		}
	}
</script>

<style lang="less">
	@import url("listpeo.less");
</style>
